import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: "/list"
    },
    {
      path: '/:p(\\w+)',
      redirect: "/list"
    },
    {
      path: '/list',
      name: 'list',
      meta: {
        title: '商品列表'
      },
      component: () => import('../views/list.vue')
    },
    {
      path: '/product/:id',
      meta: {
        title: '商品详情'
      },
      component: () => import('../views/product.vue')
    },
    {
      path: '/cart',
      meta: {
        title: '购物车'
      },
      component: () => import('../views/cart.vue')
    },
  ]
})

export default router
